package com.ceres.device.web.dao;


import com.ceres.device.pojo.OrderDevice;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface OrderDeviceMapper extends Mapper<OrderDevice> {

    /**
     * 根据用户id查询用户订单
     * @param cid
     * @return
     */
    @Select("select * from t_order_device where cid=#{cid}")
    List<OrderDevice> findByCustomerId(Integer cid);

    @Update("update t_order_device set order_status = '1' where id = #{id}")
    int updateOrder(Integer id);

    @Insert("insert into t_order_device(`id`, `did`, `cid`, `num`, `money`) values (null,#{did},#{cid},#{num},#{money})")
    void addOrder(OrderDevice orderDevice);
}
